package com.qire.manhua.activity;

import android.view.View;

import com.qire.antscore.annotation.RouteMapping;
import com.qire.common.constant.Navigation;
import com.qire.common.support.base.BaseActivity;
import com.qire.common.utils.OSUtil;
import com.qire.common.utils.ToastHelper;
import com.qire.manhua.R;

/**
 * Subscribe WeChat Official Account
 * 订阅奇热微信公众号：
 */
@RouteMapping(path = Navigation.Page.SubscribeWeChatPage)
public class SubscribeWeChatActivity extends BaseActivity {

    private volatile boolean isOpen = false;

    @Override
    public int layoutRid() {
        return R.layout.activity_subscribe_we_chat;
    }

    @Override
    public void finish() {
        if(!isOpen) {
            super.finish();
        }
    }

    public void backBtnOnClick(View v){
        finish();
    }

    public void subscribeButtonOnClick(View view){
        isOpen = true;
        OSUtil.copyToClipboard(this,"wechat","奇热漫画");
        ToastHelper.showCenterDarkToast("已复制“奇热漫画”","即将跳转至微信进行粘贴搜索");
        view.postDelayed(() -> {
//            SimpleSharingHelper.toWeChat(this);
            OSUtil.launchWeChat(this);
            isOpen = false;
            finish();
        }, 3000);
    }

}
